# STEP 1  : Save your excel file as CSV

ctr = 0
excel_filename = "test.csv"
yaml_filename = excel_filename.replace('csv', 'yml')
repos = {}

with open(excel_filename, "r") as excel_csv:
    for line in excel_csv:
        if ctr == 0:
            ctr+=1  # Skip the coumn header
        else:
            # save the csv as a dictionary
            record,repo_id,repo_name,label_final = line.strip().split(',')
            repos[record] = {'repo_id': repo_id, 'repo_name': repo_name, 'label_final': label_final}



with open(yaml_filename, "w+") as yf :
    yf.write("name: System software \n")
    yf.write("type: Tech-0 \n")
    yf.write("data: \n")
    yf.write(f"  github_repo: \n")
    for r in repos:
        if repos[r]['label_final'] == 'System software':
            yf.write(f"    - {repos[r]['repo_id']} # repo:{repos[r]['repo_name']}\n")
